#include "ThreadPool.hpp"
#include "Task.hpp"

#include <unistd.h>

using namespace ThreadPoolMoudle;

// 对线程池进行测试
int main()
{

    // 利用智能指针创建相应的线程池，防止内存泄漏
    std::unique_ptr<ThreadPool<task>> thread_pool = std::make_unique<ThreadPool<task>>();

    thread_pool->InintThreadPool();
    thread_pool->Start();
    sleep(2);
    int cent = 10;
    while (cent)
    {
        thread_pool->Enqueue(Push);
        cent--;
        sleep(1);
    }
    
    thread_pool->Stop();

    sleep(3);
    thread_pool->Wait();

    return 0;
}